{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation form-search" method="post" action="{{:MyUrl('admin/admin/index')}}" request-type="form">
			<div class="thin">
                <div class="am-input-group am-input-group-sm am-fl so">
                    <input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="用户名/手机" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
                    <span class="am-input-group-btn">
                        <button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                    </span>
                </div>
                <label class="am-fl thin_sub more-submit">
                    更多筛选条件
                    {{if isset($params['is_more']) and $params['is_more'] eq 1}}
                        <input type="checkbox" name="is_more" value="1" id="is_more" checked />
                        <i class="am-icon-angle-up"></i>
                    {{else /}}
                        <input type="checkbox" name="is_more" value="1" id="is_more" />
                        <i class="am-icon-angle-down"></i>
                    {{/if}}
                </label>
            </div>
            <table class="so-list more-where {{if !isset($params['is_more'])}}none{{/if}}">
                <tbody>
                	<tr>
                		<td>
                			<span>权限：</span>
							<select name="role_id" class="chosen-select" data-placeholder="权限组...">
								<option value="-1">权限组...</option>
								{{foreach $role as $v}}
									<option value="{{$v.id}}" {{if isset($params['role_id']) and $params['role_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
								{{/foreach}}
							</select>
                		</td>
                		<td>
                			<span>性别：</span>
							<select name="gender" class="chosen-select" data-placeholder="性别...">
								<option value="-1">性别...</option>
								{{foreach $common_gender_list as $v}}
									<option value="{{$v.id}}" {{if isset($params['gender']) and $params['gender'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
								{{/foreach}}
							</select>
                		</td>
                        <tr>
                        <td class="time">
                            <span>时间：</span>
                            <span>
                                <input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
                            </span>
                            <em class="text-grey">~</em>
                            <span>
                                <input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
                            </span>
                        </td>
                        <td>
                            <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                            <a href="{{:MyUrl('admin/admin/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
                        </td>
                    </tr>
                	</tr>
                </tbody>
			</table>
        </form>
        <!-- form end -->


		<!-- operation start -->
		<div class="am-g m-t-15">
			<a href="{{:MyUrl('admin/admin/saveinfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> 新增</a>
		</div>
		<!-- operation end -->

		<!-- list start -->
		<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
			<thead>
				<tr>
					<th>管理员</th>
					<th>性别</th>
					<th>登录次数</th>
					<th>手机号码</th>
					<th class="am-hide-sm-only">权限组</th>
					<th class="am-hide-sm-only">最后登录时间</th>
					<th class="am-hide-sm-only">创建时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{{if !empty($data)}}
					{{foreach $data as $v}}
						<tr id="data-list-{{$v.id}}">
							<td>{{$v.username}}</td>
							<td>{{:lang('common_gender_list')[$v['gender']]['name']}}</td>
							<td>{{$v.login_total}}</td>
							<td>{{if empty($v['mobile'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.mobile}}{{/if}}</td>
							<td class="am-hide-sm-only">{{$v.role_name}}</td>
							<td class="am-hide-sm-only">
								{{if $v['login_total'] eq 0}}
									未登录
								{{else /}}
									{{:date('Y-m-d H:i:s', $v['login_time'])}}
								{{/if}}
							</td>
							<td class="am-hide-sm-only">{{:date('Y-m-d H:i:s', $v['add_time'])}}</td>
							<td>
								{{if $v['id'] eq 1}}
									<span class="cr-ccc">不可操作</span>
								{{else /}}
									<a href="{{:MyUrl('admin/admin/saveinfo', array('id'=>$v['id']))}}">
										<button class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-edit" > 编辑</button>
									</a>
									{{if $v['id'] neq $admin['id']}}
										<button class="am-btn am-btn-danger am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:MyUrl('admin/admin/delete')}}" data-id="{{$v.id}}"> 删除</button>
									{{/if}}
								{{/if}}
							</td>
						</tr>
					{{/foreach}}
				{{/if}}
			</tbody>
		</table>
        {{if empty($data)}}
            <div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
        {{/if}}
		<!-- list end -->

		<!-- page start -->
		{{if !empty($data)}}
			{{$page_html|raw}}
		{{/if}}
		<!-- page end -->
	</div>
</div>
<!-- right content end  -->

{{include file="public/footer" /}}